﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

///<summary>
///
///</summary>
public class CloudComponet : MonoBehaviour
{
    public float speed;
    float CloudNum = 2 ;
    float CloudWidth = 1060;
    float totalWidth;
    private void Start()
    {
        totalWidth = CloudNum * CloudWidth;
    }
    // Update is called once per frame
    void Update()
    {
        transform.Translate(Vector2.right * speed * Time.deltaTime);
        if (transform.position.x > 1680)
        {
            Vector3 pos = transform.position;
            pos.x -= totalWidth;
            pos.y = transform.position.y;
            transform.position = pos;
        }
    }  
}
